package com.bluefish.bltuan.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.bluefish.bltuan.dao.ManagerDao;
import com.bluefish.bltuan.module.user.Manager;

@Repository
public class ManagerDaoImpl extends AbstractDaoImpl<Manager, Integer> implements ManagerDao {

	private static final long serialVersionUID = -7494316746897385728L;


	private static final String USERNAME = "username";
	
	private static final String PASSWOED = "password";

	public Manager findByUsername(String username) {
		List<Manager> managers = listByProperty(USERNAME, username);
		return managers.isEmpty() ? null : managers.get(0);
	}

	public Manager getByNameAndPassword(String username, String password) {
		List<Manager> managers = listByPropertys(new String[]{USERNAME,PASSWOED}, new String[]{username,password});
		return managers.isEmpty() ? null : managers.get(0);
	}

	

}
